﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebAddressBook
{
    public partial class HeaderControl : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Adrr.Model.UserInfo userInfo = new Adrr.Model.UserInfo();
                userInfo = Session["userInfo"] as Adrr.Model.UserInfo;
                LbLoginName.Text = userInfo.UserID;
                //做一个权限控制
                if (userInfo.UserID != "admin")
                {
                    companyLi.Visible = false;
                    backSetting.Visible = false;
                }
                else
                {
                    companyLi.Visible = true;
                    backSetting.Visible = true;
                }
            }
        }

        protected void LKLoginOut_Click(object sender, EventArgs e)
        {
            Session["userInfo"] = null;
            Session.Abandon();
            Response.Redirect("Login.aspx");
        }
    }
}